package _2025_3_12;

import java.util.Random;

public class demo1 {
    public static int sum1=0;
    public static int sum2=0;
    public static void main(String[] args) throws InterruptedException {
        long []arr=new long[1000_00000];
        int sum=0;
        for (int i=0;i<arr.length;i++){
            arr[i]= new Random().nextInt(100);
            sum+=arr[i];
        }
        Thread t1 = new Thread (()->{
            for (int i = 0; i <arr.length ; i+=2) {
                sum1+=arr[i];
            }
        });
        Thread t2 = new Thread (()->{
            for (int i = 1; i <arr.length ; i+=2) {
                sum2+=arr[i];
            }
        });
        t1.start();
        t2.start();
        t1.join();
        t2.join();
        System.out.println(sum1+sum2);
        System.out.println(sum);
        System.out.println(sum==sum1+sum2);
    }
}
